home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / usr_-_Usr_Files / INCLUDE / GLOB.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  3KB  |  82 lines

  1. /* Copyright (C) 1991, 1992 Free Software Foundation, Inc.
  2.  
  3. This library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7.  
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  11. Library General Public License for more details.
  12.  
  13. You should have received a copy of the GNU Library General Public
  14. License along with this library; see the file COPYING.LIB.  If
  15. not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16. Cambridge, MA 02139, USA.  */
  17.  
  18. #ifndef    _GLOB_H
  19.  
  20. #define    _GLOB_H    1
  21.  
  22. #include <features.h>
  23.  
  24. __BEGIN_DECLS
  25.  
  26. /* Bits set in the FLAGS argument to `glob'.  */
  27. #define    GLOB_ERR    (1 << 0)/* Return on read errors.  */
  28. #define    GLOB_MARK    (1 << 1)/* Append a slash to each name.  */
  29. #define    GLOB_NOSORT    (1 << 2)/* Don't sort the names.  */
  30. #define    GLOB_DOOFFS    (1 << 3)/* Insert PGLOB->gl_offs NULLs.  */
  31. #define    GLOB_NOCHECK    (1 << 4)/* If nothing matches, return the pattern.  */
  32. #define    GLOB_APPEND    (1 << 5)/* Append to results of a previous call.  */
  33. #define    GLOB_NOESCAPE    (1 << 6)/* Backslashes don't quote metacharacters.  */
  34. #define    GLOB_PERIOD    (1 << 7)/* Leading `.' can be matched by metachars.  */
  35. #define    __GLOB_FLAGS    (GLOB_ERR|GLOB_MARK|GLOB_NOSORT|GLOB_DOOFFS| \
  36.              GLOB_NOESCAPE|GLOB_NOCHECK|GLOB_APPEND|GLOB_PERIOD)
  37.  
  38. #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_BSD_SOURCE)
  39. #define    GLOB_MAGCHAR    (1 << 8)/* Set in gl_flags if any metachars seen.  */
  40. #endif
  41.  
  42. /* Error returns from `glob'.  */
  43. #define    GLOB_NOSPACE    1    /* Ran out of memory.  */
  44. #define    GLOB_ABEND    2    /* Read error.  */
  45. #define    GLOB_NOMATCH    3    /* No matches found.  */
  46.  
  47. /* Structure describing a globbing run.  */
  48. typedef struct
  49.   {
  50.     int gl_pathc;        /* Count of paths matched by the pattern.  */
  51.     char **gl_pathv;        /* List of matched pathnames.  */
  52.     int gl_offs;        /* Slots to reserve in `gl_pathv'.  */
  53.     int gl_flags;        /* Set to FLAGS, maybe | GLOB_MAGCHAR.  */
  54.   } glob_t;
  55.  
  56. /* Do glob searching for PATTERN, placing results in PGLOB.
  57.    The bits defined above may be set in FLAGS.
  58.    If a directory cannot be opened or read and ERRFUNC is not nil,
  59.    it is called with the pathname that caused the error, and the
  60.    `errno' value from the failing call; if it returns non-zero
  61.    `glob' returns GLOB_ABEND; if it returns zero, the error is ignored.
  62.    If memory cannot be allocated for PGLOB, GLOB_NOSPACE is returned.
  63.    Otherwise, `glob' returns zero.  */
  64. extern int glob __P ((__const char *__pattern, int __flags,
  65.               int (*__errfunc)(__const char *, int),
  66.               glob_t *__pglob));
  67.  
  68. /* Free storage allocated in PGLOB by a previous `glob' call.  */
  69. extern void globfree __P ((glob_t *__pglob));
  70.  
  71.  
  72. #if !defined (_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 2 || defined (_GNU_SOURCE)
  73. /* If they are not NULL, `glob' uses these functions to read directories.  */
  74. extern __ptr_t (*__glob_opendir_hook) __P ((__const char *__directory));
  75. extern __const char *(*__glob_readdir_hook) __P ((__ptr_t __stream));
  76. extern void (*__glob_closedir_hook) __P ((__ptr_t __stream));
  77. #endif
  78.  
  79. __END_DECLS
  80.  
  81. #endif /* glob.h  */
  82.